<?php
/**
 * 定制
 *
 * @copyright  Copyright (c) 2015-2025 NcPHP Inc. (http://www.ncphp.com)
 * @license    http://www.ncphp.com/
 * @link       http://www.ncphp.com/
 * @author     NcPHP Team
 * @since      File available since Release v1.1
 */
defined('InNcPHP') or exit('Access Invalid!');

class customizeControl extends BaseHomeControl{

    public function __construct(){
        parent::__construct();
    }

    /**
     * 定制功能
     */
    public function indexOp(){
        if (chksubmit()) {
            /** @var customizeModel $model */
            $model = Model('customize');
            $params = array(
                's_addr' => $_POST['s_addr'],
                'e_addr' => $_POST['e_addr'],
                'type' => intval($_POST['type']) ? 1 : 0,
                'company' => isset($_POST['company']) ? $_POST['company'] : '',
                'username' => $_POST['username'],
                'num' => intval($_POST['num']),
                'phone' => $_POST['phone'],
                '`require`' => $_POST['require'],
                'addtime' => time(),
                'member_id' => $_SESSION['member']['member_id'],
            );
            $res = $model->addCustomize($params);
            output_data($res);
        }
        Tpl::output('is_weixin',$this->is_weixin());
        Tpl::showpage('customize.index');
    }


    public function testredisOp(){
        $row=20;
        $this->redis = new Redis();
        $this->deploy = C('redis');
        $this->redis->connect($this->deploy['master']['host'],$this->deploy['master']['port']);
        $pxname = $this->deploy['prefix'].'orderpx';
        $res  = $this->redis->zRevRange($pxname,0,-1);

        $pk_list = array();
        foreach($res as $k){
            $order_id = substr($k,9);
            $pk_list[] = $this->redis->hGetAll($this->deploy['prefix'].'orders'.$order_id);

        }
        foreach ($pk_list as $k =>$v){

            /*$monthordername= $this->deploy['prefix'].'month_order'.$v['order_id'];
            $this->redis->hSet($monthordername,'order_id',$v['order_id']);
            $this->redis->hSet($monthordername,'in_all',$v['in_all']);//砍价总次数
            $this->redis->hSet($monthordername,'nickname',$v['nickname']);//用户昵称
            $this->redis->hSet($monthordername,'bg_title',$v['bg_title']);//商品名称*/
        }


    }
}
